# 查找 common 目录下的所有源文件
file(GLOB COMMON_SOURCES
    "common/*.cpp"
)

# 查找所有的头文件
file(GLOB_RECURSE HEADERS
    "*.h"
    "include/*.h"
    "common/*.h"
)

# 创建 common 静态库
add_library(common_lib STATIC ${COMMON_SOURCES} ${HEADERS})

# 为 common_lib 添加 include 目录
target_include_directories(common_lib PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_CURRENT_SOURCE_DIR}/common
)

# 为 common_lib 添加需要的链接库
target_link_libraries(common_lib
    pthread
    graphic_lsf
    panoStitchApp
    rkgfx_avs
    RkSwCac
    rockit
)

# 创建可执行文件
add_executable(test_mpi_venc test_mpi_venc.cpp)

# 为 test_mpi_venc 添加 include 目录
target_include_directories(test_mpi_venc PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_CURRENT_SOURCE_DIR}/common
)

# 链接 test_mpi_venc 与 common_lib
target_link_libraries(test_mpi_venc
    common_lib
)


# 创建可执行文件
add_executable(test_mpi_vi test_mpi_vi.cpp)

# 为 test_mpi_venc 添加 include 目录
target_include_directories(test_mpi_vi PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_CURRENT_SOURCE_DIR}/common
)
# 链接 test_mpi_venc 与 common_lib
target_link_libraries(test_mpi_vi
    common_lib
)

# 创建可执行文件
add_executable(hx_test_h264_jpeg hx_test_h264_jpeg.cpp)

target_include_directories(hx_test_h264_jpeg PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_CURRENT_SOURCE_DIR}/common
)

target_link_libraries(hx_test_h264_jpeg
    common_lib
)


add_executable(hx_test_h264_jpeg_2 hx_test_h264_jpeg_2.cpp)

target_include_directories(hx_test_h264_jpeg_2 PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_CURRENT_SOURCE_DIR}/common
)

target_link_libraries(hx_test_h264_jpeg_2
    common_lib
)

add_executable(hx_test_h264_jpeg_3 hx_test_h264_jpeg_3.cpp)

target_include_directories(hx_test_h264_jpeg_3 PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_CURRENT_SOURCE_DIR}/common
)

target_link_libraries(hx_test_h264_jpeg_3
    common_lib
)

add_executable(hx_test_vi hx_test_vi.cpp)

target_include_directories(hx_test_vi PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_CURRENT_SOURCE_DIR}/common
)

target_link_libraries(hx_test_vi
    common_lib
)
# 创建可执行文件
# add_executable(udp_test udp_test.cpp)

# target_include_directories(udp_test PRIVATE
#     ${CMAKE_CURRENT_SOURCE_DIR}/include
#     ${CMAKE_CURRENT_SOURCE_DIR}/common
# )

# target_link_libraries(udp_test
#     common_lib
# )

# add_executable(udp_client udp_client.cpp)